import request from '@/utils/request'

// 查询公司表列表
export function listCompany(query) {
    return request({
        url: '/business/company/list',
        method: 'get',
        params: query
    })
}

// 查询公司表详细
export function getCompany(companyId) {
    return request({
        url: '/business/company/' + companyId,
        method: 'get'
    })
}

// 新增公司表
export function addCompany(data) {
    return request({
        url: '/business/company',
        method: 'post',
        data: data
    })
}

// 修改公司表
export function updateCompany(data) {
    return request({
        url: '/business/company',
        method: 'put',
        data: data
    })
}

// 删除公司表
export function delCompany(companyId) {
    return request({
        url: '/business/company/' + companyId,
        method: 'delete'
    })
}

export function updateCompanyMenu(data) {
    return request({
        url: '/business/company/menu/updateCompanyMenu',
        method: 'put',
        data: data
    })
}

export function treeSelect() {
    return request({
        url: '/business/company/treeSelect',
        method: 'get'
    })
}

// 修改密码
export function updateUserPwd(oldPassword, newPassword) {
    const data = {
        oldPassword,
        newPassword
    }
    return request({
        url: '/business/company/updatePwd',
        method: 'put',
        params: data
    })
}

export function uploadAvatar(data) {
    return request({
        url: '/business/company/updateAvatar',
        method: 'post',
        data: data
    })
}

export function uploadLogo(data) {
    return request({
        url: '/business/company/updateLogo',
        method: 'post',
        data: data
    })
}

// 修改用户个人信息
export function updateUserProfile(data) {
    return request({
        url: '/business/company/updateProfile',
        method: 'put',
        data: data
    })
}

// 查询经销商个人信息
export function getUserProfile() {
    return request({
        url: '/company/profile',
        method: 'get'
    })
}
